package service;

import model.College;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class CollegeService {
    private CollegeDao dao;
    @Autowired
    public void setCollegeDao(CollegeDao dao){
        this.dao=dao;
    }
    public boolean deleteCollege(int collegeId){
        return dao.deleteCollege(collegeId)>0;
    }
    public ArrayList<College> getCollege(int collegeId){
        return dao.findCollegeByCollegeid(collegeId);
    }
    public ArrayList<College> getCollege(String coName){
        return dao.findCollegeByConame(coName);
    }
    public ArrayList<College> getAllColleges(){
        return dao.getAllColleges();
    }
    public boolean editCollege(College college){
        return dao.editCollege(college)>0;
    }
    public boolean addCollege(College college){
        return  dao.addCollege(college)>0;
    }
}
